#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  for (int a = 0; a <= sqrt(n); a++) {
    for (int b = a; b <= sqrt(n); b++) {
      for (int c = b; c <= sqrt(n); c++) {
        int d = n - a * a - b * b - c * c;
        int k = sqrt(d);
        if (k * k == d && k>=c)
          cout << a << " " << b << " " << c << " " << k << endl;
      }
    }
  }

  return 0;
}